// app.js
App({
      globalData:{
        navHeight: "", //导航栏高度
        navTop: "", //导航栏距顶部距离
        navObj: "", //胶囊的高度
        navObjWid: "", //胶囊宽度+距右距离
      },
      onLaunch(){
        let menuButtonObject = wx.getMenuButtonBoundingClientRect();
        wx.getSystemInfo({
            success: res => {
                //导航高度
                let statusBarHeight = res.statusBarHeight,
                navTop = menuButtonObject.top,
                navObjWid = res.windowWidth - menuButtonObject.right + menuButtonObject.width, // 胶囊按钮与右侧的距离 = windowWidth - right+胶囊宽度
                navHeight = statusBarHeight + menuButtonObject.height + (menuButtonObject.top - statusBarHeight) * 2;
                this.globalData.navHeight = navHeight; //导航栏总体高度
                this.globalData.navTop = navTop; //胶囊距离顶部距离
                this.globalData.navObj = menuButtonObject.height; //胶囊高度
                this.globalData.navObjWid = navObjWid; //胶囊宽度(包括右边距离)
                // console.log(navHeight,navTop,menuButtonObject.height,navObjWid)
            },
            fail(err) {
                console.log(err);
            }
        })
      }

})